<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script>
    //闭包的作用: 扩展了变量的作用范围
     function fn(){
       var num =10;
       return function () {
         console.log(num);
      }
     }
     var f = fn()
     f()
  </script>
</body>
</html>